-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[sw/bootloader] add TWI boot option #1108
base: main
Are you sure you want to change the base?
Conversation
The bootloader gets to big if all options are enables. How should we handle this? Maybe disable TWI by default but add an additional test where SPI is disabled instead? (I'm gonna extend the documentation when we resolved this) |
Nice! Thank you very much!
Oh I know this problem... 🙈
I was thinking about rewriting the bootloader in plain assembly... But to be honest, I'm too lazy for that... 😅 So yes, we could disable the TWI option by default and let the user decide if this is a relevant feature. |
I actually use the C ISA extension so the bootloader is always small enough, but I guess I'll change the default and then the user can enable it if needed. I would actually suggest changing the warning as well and recommend recompiling the bootloader for each processor to enable a potentially smaller bootloader, what do you think? |
While writing to the TWI memory via the bootloader is not planned, I will probably upload a Python script to flash via an USB I2C adapter. |
That's a good solution! But I would recommend to provide the pre-built bootloader image compiled with the minimal ISA options only - so it is compatible to any ISA configuration.
Which warning? Sure, we could add a note/tip to the according section of the documentation for this. Btw, we have already enabled link-time-optimization and However, maybe it is worth a try to compile the bootloader with the absolute minimal ISA configuration which is
I think we could re-use parts of the "SPI write" code? I just scanned your code briefly, but I think you are using a fixed number of address bytes for accessing the TWI flash, right? Maybe we could also make this configurable just like we did for the SPI accesses. |
I agree, the pre-built should be compatible with any (but E currently) ISA configuration. But we could encourage the user to build the bootloader to their needs and ISA.
This one in
But actually I'm fine with it, because the first part says to allow, which actually implies if you need it...
Probably not?
I'll look into it. This would also have the advantage that the bootloader would actually work on all ISA configurations.
Probably yes? Unfortunately I don't have a use case at the moment, but I keep it in mind. Probably not in this PR though. Some other bootloader extensions have a higher priority, you'll see :)
I agree, I'll add that one! |
👍
Oh, right. I forgot about that... I think we could remove that. It does not capture all possible ISA extensions. So basically it is useless.
Interesting! I was not aware of that option. I'll look it up.
I just tested that and it saves more than 100 bytes (yeay!). -> #1118
Cool, thanks! |
Seems to work on the newest version as well :) only tested without clint/autoboot and only on the two-address-byte eeprom but I haven't noticed any relevant commits anyways. |
This looks great, thank you very much! However, I'm not sure about the EEPROM tool. It is a cool feature and a handy tool, but this seems to be quite application-specific, right? 🤔 |
I suppose there could be FPGA models as well, but no additional testing would be required on my part.
It kind of is. It should work with all kinds of I2C chips, but yeah, it's only for a weirdly specific USB adapter. I'll remove it from the branch then.
I agree :) |
Now the renaming should have an end, sorry for alle the different commits :) feel free to squash |
#if (SPI_EN != 0) | ||
get_exe(EXE_STREAM_FLASH); // try booting from flash | ||
#elif (TWI_EN != 0) | ||
get_exe(EXE_STREAM_TWI); // try booting from twi | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mean we either use SPI or TWI, but not both, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right for autobooting.
I thought anyone with SPI flash would prefer it to any I2C memory, but this could be configurable. Just another #define
with the desired EXE_STREAM_SOURCE_enum
. And a check, I guess, if the selected option is available. What do you think?
This looks great! I just have some minor comments. 😉 By the way... How about also adding an option to store an image to TWI memory (similar to the SPI programming option)? |
Thanks! And also thanks for the suggestions.
I actually already answered this (#1108 (comment)), but no worries. I don't have a use case right now, but I'm keeping it in mind. Probably not in this PR though. |
Add ability to read program from TWI (also known as I2C) memory like common EEPROMs with one address byte.